package com.itheima.service.impl;

import com.itheima.mapper.*;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.CheckItem;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class SetmealServiceImpl implements SetmealService {
    @Autowired
    @Qualifier("setmealMapper")
    private SetmealMapper setmealMapper;

    @Autowired
    private SetmealMobileMapper setmealMobileMapper;

    /**
     * 查询所有套餐
     * @return
     */
    @Override
    public List<Setmeal> findAll() {
        return setmealMapper.selectAll();
    }

    /**
     * 根据套餐id查询套餐详情
     * @param id
     * @return
     */
    @Override
    public Setmeal findById(Integer id) {
        // 首先查询套餐基本信息
        Setmeal setmeal = setmealMapper.findDetailById(id);
        log.info("根据套餐id查询套餐详情, 套餐信息为{}", setmeal);
        return setmeal;
    }
}
